import com.example.commons.core.idcard.IdCardGenerator
import org.junit.jupiter.api.Test
import java.time.Month
import java.time.Year
import kotlin.math.floor

class IdcardTest {

    @Test
    fun test2() {

//        val len = Year.now().value - 1900
//        val year = (Math.random() * len + 1900).toInt()
//
        val month = ((Math.random() + 1) * 12)//.toInt()
        val monthf = floor(month).toInt()
//
//        val monthLen = Month.of(month).maxLength()
//        val day = (Math.random() * monthLen).toInt()
//
//        println(year)
//        println(month)
//        println(day)


        println(monthf)// 1<=x<2
    }

    @Test
    fun gen() {
        val idcard = IdCardGenerator.getInstance().generate()
//        val codeJson = AreaCode::class.java.getResourceAsStream("/static/id_card_area_code.json")
//        val idcard = Json.decodeFromString(ListSerializer(AreaCode.serializer()), String(codeJson.readBytes()))
        println(idcard)
    }
}